{% extends "base.html" %}
{% load i18n %}

{% block title %}{% trans "Bilder hinzufügen | fha-django-gallery" %}{% endblock %}

{% block extrahead %}
    <link rel="stylesheet" type="text/css" media="all" href="{{ MEDIA_URL }}lib/css/swfupload.css" />
    <script type="text/javascript" src="{{ MEDIA_URL }}lib/js/swfupload.js"></script>
    <script type="text/javascript" src="{{ MEDIA_URL }}lib/js/swfupload.queue.js"></script>
    <script type="text/javascript" src="{{ MEDIA_URL }}lib/js/swfupload.swfobject.js"></script>
    <script type="text/javascript" src="{{ MEDIA_URL }}lib/js/swfupload.cookies.js"></script>
    <script type="text/javascript" src="{{ MEDIA_URL }}lib/js/swfupload.fileprogress.js"></script>
    <script type="text/javascript" src="{{ MEDIA_URL }}lib/js/swfupload.handlers.js"></script>
    <script type="text/javascript">
    var swfu;
    
    SWFUpload.onload = function () {
        var settings = {
            flash_url: '{{ MEDIA_URL }}lib/js/swfupload.swf',
            upload_url: '{% url gallery_add slug=slug %}',
            file_size_limit: '10 MB',
            file_types: '*.*',
            file_types_description: 'Bilddateien',
            file_upload_limit: 100,
            file_queue_limit: 0,
            custom_settings: {
                progressTarget : 'fsUploadProgress',
                cancelButtonId : 'btnCancel'
            },
            post_params: {
                'csrfmiddlewaretoken': '{{ csrf_token }}',
                'slug': '{{ slug }}'
            },
            debug: false,
    
            // Button Settings
            button_placeholder_id: "spanButtonPlaceholder",
            button_width: 128,
            button_height: 30,
            button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
            button_cursor: SWFUpload.CURSOR.HAND,
    
            // The event handler functions are defined in handlers.js
            swfupload_loaded_handler: swfUploadLoaded,
            file_queued_handler: fileQueued,
            file_queue_error_handler: fileQueueError,
            file_dialog_complete_handler: fileDialogComplete,
            upload_start_handler: uploadStart,
            upload_progress_handler: uploadProgress,
            upload_error_handler: uploadError,
            upload_success_handler: uploadSuccess,
            upload_complete_handler: uploadComplete,
            queue_complete_handler: queueComplete,	// Queue plugin event
            
            // SWFObject settings
            minimum_flash_version: "9.0.28",
            swfupload_pre_load_handler: swfUploadPreLoad,
            swfupload_load_failed_handler: swfUploadLoadFailed
        };
    
        swfu = new SWFUpload(settings);
    }
    </script>
{% endblock %}

{% url gallery_add slug=slug as gallery_add %}

{% block breadcrumbs %}
    {% blocktrans %}
        Sie befinden sich hier: <a href="/">fha-django-gallery</a> &raquo; 
        <a href="/account/profile/">Account</a> &raquo;
        <a href="{{ gallery_add }}">Bilder hinzufügen</a>
    {% endblocktrans %}
{% endblock %}

{% block content %}
    <h2>{% trans "Bilder zur Galerie hinzufügen" %}</h2>
    <p>{% trans "Um Bilder zur Galerie hinzuzufügen, wählen sie diese bitte aus und klicken anschließend auf Weiter" %}</p>
    <p><a href="{% url gallery_edit slug=slug %}" class="button blue">{% trans "Weiter" %}</a></p>
    <div id="divSWFUploadUI">
        <div class="fieldset flash" id="fsUploadProgress">
            <span class="legend">Warteschlange</span>
        </div>
        <p id="divStatus">0 Dateien hochgeladen</p>
        <p>
            <span id="spanButtonPlaceholder"></span>
            <button id="btnUpload" class="red" type="button">Dateien auswählen</button>
            <button id="btnCancel" type="button" disabled="disabled">Uploads abbrechen</button>
        </p>
    </div>
    <noscript style="background-color: #FFFF66; border-top: solid 4px #FF9966; border-bottom: solid 4px #FF9966; margin: 10px 25px; padding: 10px 15px;">
        {% trans "We're sorry. SWFUpload could not load. You must have JavaScript enabled to enjoy SWFUpload." %}
    </noscript>
    <div id="divLoadingContent" class="content" style="background-color: #FFFF66; border-top: solid 4px #FF9966; border-bottom: solid 4px #FF9966; margin: 10px 25px; padding: 10px 15px; display: none;">
        {% trans "SWFUpload is loading. Please wait a moment..." %}
    </div>
    <div id="divLongLoading" class="content" style="background-color: #FFFF66; border-top: solid 4px #FF9966; border-bottom: solid 4px #FF9966; margin: 10px 25px; padding: 10px 15px; display: none;">
        {% trans "SWFUpload is taking a long time to load or the load has failed.  Please make sure that the Flash Plugin is enabled and that a working version of the Adobe Flash Player is installed." %}
    </div>
    <div id="divAlternateContent" class="content" style="background-color: #FFFF66; border-top: solid 4px #FF9966; border-bottom: solid 4px #FF9966; margin: 10px 25px; padding: 10px 15px; display: none;">
        {% blocktrans %}
            We're sorry. SWFUpload could not load. You may need to install or upgrade Flash Player. Visit the <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Adobe website</a> to get the Flash Player.
        {% endblocktrans %}
    </div>
{% endblock %}
